package org.example.demoblg.result;

import lombok.Data;

@Data
public class Result <T>{
    private Integer code;
    private String message;
    private T data;
  public static <T> Result<T> success(T data){

      Result result = new Result();
      result.setCode(200);
      result.setMessage("success");
      result.setData(data);
      return result;

  }
  public static <T> Result<T> unlogin(String message){
      Result result = new Result();
    result.setCode(Constant.RESULT_CODE_UNLOGIN);
      result.setMessage("用户未登录");
      result.setData(null);
      return result;
  }
  public static <T> Result<T> fail(Integer code, String message){
      Result result = new Result();
      result.setCode(code);
      result.setMessage(message);

      return result;

  }
}
